package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkCalcDatabase;
import com.ysd.lis.service.WkCalcDatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 绩效考核-数据源字典表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2024-04-18
 */
@RestController
@RequestMapping("/wk/calc/database")
public class WkCalcDatabaseController extends BaseController {

    @Autowired
    WkCalcDatabaseService wkCalcDatabaseService;

    @GetMapping("/getDataBaseList")
    public Result getDataBaseList(@RequestParam(value = "keyWord", required = false) String keyWord) {
        return wkCalcDatabaseService.getDataBaseList(keyWord);
    }

    @PostMapping("/addDataBase")
    public Result addDataBase(@RequestBody WkCalcDatabase wkCalcDatabase) {
        return wkCalcDatabaseService.addDatabase(wkCalcDatabase);
    }

    @PostMapping("/editDataBase")
    public Result editDataBase(@RequestBody WkCalcDatabase wkCalcDatabase) {
        return wkCalcDatabaseService.editDatabase(wkCalcDatabase);
    }

    @PostMapping("/deleteDataBase")
    public Result deleteDataBase(@RequestBody List<String> ids) {
        return wkCalcDatabaseService.deleteDatabase(ids);
    }

    @PostMapping("/testDatabaseConnection")
    public Result testDatabaseConnection(@RequestBody WkCalcDatabase wkCalcDatabase) {
        return wkCalcDatabaseService.testDatabaseConnection(wkCalcDatabase);
    }

}
